<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace AlibabaCloud\Client\Credentials\Ini;

trait OptionsTrait
{
    private static function setClientAttributes($configures, \AlibabaCloud\Client\Clients\Client $client)
    {
        if(self::isNotEmpty($configures, "region_id")) {
            $client->regionId($configures["region_id"]);
        }
        if(isset($configures["debug"])) {
            $client->options(["debug" => (bool) $configures["debug"]]);
        }
        if(self::isNotEmpty($configures, "timeout")) {
            $client->options(["timeout" => $configures["timeout"]]);
        }
        if(self::isNotEmpty($configures, "connect_timeout")) {
            $client->options(["connect_timeout" => $configures["connect_timeout"]]);
        }
    }
    private static function setProxy($configures, \AlibabaCloud\Client\Clients\Client $client)
    {
        if(self::isNotEmpty($configures, "proxy")) {
            $client->options(["proxy" => $configures["proxy"]]);
        }
        $proxy = [];
        if(self::isNotEmpty($configures, "proxy_http")) {
            $proxy["http"] = $configures["proxy_http"];
        }
        if(self::isNotEmpty($configures, "proxy_https")) {
            $proxy["https"] = $configures["proxy_https"];
        }
        if(self::isNotEmpty($configures, "proxy_no")) {
            $proxy["no"] = explode(",", $configures["proxy_no"]);
        }
        if($proxy !== []) {
            $client->options(["proxy" => $proxy]);
        }
    }
    private static function setCert($configures, \AlibabaCloud\Client\Clients\Client $client)
    {
        if(self::isNotEmpty($configures, "cert_file") && !self::isNotEmpty($configures, "cert_password")) {
            $client->options(["cert" => $configures["cert_file"]]);
        }
        if(self::isNotEmpty($configures, "cert_file") && self::isNotEmpty($configures, "cert_password")) {
            $client->options(["cert" => [$configures["cert_file"], $configures["cert_password"]]]);
        }
    }
}

?>